home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.net;
-
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.EOFException;
- import java.io.IOException;
- import java.util.Vector;
- import symjava.sql.SQLException;
-
- class SessionRequest extends Requester {
- int _id;
- // $FF: renamed from: _v java.util.Vector
- Vector field_0;
- int _mode;
- NetString _reqStr;
-
- SessionRequest(ClientSession sess) {
- super(sess);
- }
-
- protected IO getIO() throws NetException, SQLException {
- return this._mode == 1 ? super._io : super.getIO();
- }
-
- protected void releaseIO() {
- if (this._mode != 1) {
- super.releaseIO();
- }
- }
-
- int connect() throws NetException {
- this._mode = 0;
- this._id = 0;
- this._reqStr = new NetString("session" + super._reqDelim + "connect" + super._reqDelim + 1 + super._reqDelim + 0);
-
- try {
- ((Requester)this).execute();
- return this._id;
- } catch (SQLException e) {
- throw new NetException(((Throwable)e).getMessage());
- } catch (Exception var3) {
- throw new NetException("Unable to connect to server.");
- }
- }
-
- void reconnect(IO io, int connectionID) throws NetException {
- this._mode = 1;
- super._io = io;
- this._reqStr = new NetString("session" + super._reqDelim + "reconnect" + super._reqDelim + connectionID);
-
- try {
- ((Requester)this).execute();
- } catch (Exception var3) {
- throw new NetException("Error reconnecting IO object.");
- }
- }
-
- void loginPublic(String userName, String password) throws SQLException {
- this._mode = 2;
- this._reqStr = new NetString("session" + super._reqDelim + "loginpublic" + super._reqDelim + userName + super._reqDelim + password);
- ((Requester)this).execute();
- }
-
- void loginPrivate(String key, String userName, String password) throws SQLException {
- this._mode = 3;
- this._reqStr = new NetString("session" + super._reqDelim + "loginprivate" + super._reqDelim + key + super._reqDelim + userName + super._reqDelim + password);
- ((Requester)this).execute();
- }
-
- Vector getRepositoryList() throws SQLException {
- this._mode = 4;
- this.field_0 = null;
- this._reqStr = new NetString("session" + super._reqDelim + "getRepList");
- ((Requester)this).execute();
- if (this.field_0 == null) {
- throw new SQLException("Error getting repository list.");
- } else {
- return this.field_0;
- }
- }
-
- void disconnect() {
- this._mode = 5;
- this._reqStr = new NetString("session" + super._reqDelim + "disconnect");
-
- try {
- ((Requester)this).execute();
- } catch (Exception var1) {
- }
- }
-
- protected void readResults(DataInputStream in) throws SQLException, IOException, ErrorException {
- if (this._mode != 5) {
- ServerObject obj = (ServerObject)NetClass.getNextObject(in);
- if ((this._mode == 0 || this._mode == 1 || this._mode == 2 || this._mode == 3) && obj.getType() == 51) {
- if (this._mode == 0) {
- try {
- this._id = ((NetData)obj).getInt();
- } catch (EOFException var3) {
- throw new IOException();
- }
- }
- } else if (this._mode == 4 && obj.getType() == 54) {
- this.field_0 = ((ServerList)obj).toStringVector();
- } else {
- ((Requester)this).onObjectError(obj);
- }
- }
- }
-
- protected void writeRequest(DataOutputStream out) throws IOException {
- this._reqStr.write(out);
- }
- }
-